package com.java.exer1;

public class AccountTest_2 {
    private double balance;

    public AccountTest_2(double init_balance) {
        balance = init_balance;
    }

    public double getBalance() {
        return balance;
    }

    public void deposit(double amt) {
        if (0 < amt) {
            balance += amt;
            System.out.println("本次存款金额为：" + amt + "余额为" + balance);
        } else {
            System.out.println("您输入的金额有误");
        }
    }

    public void withdraw(double amt) {
        if (balance > amt) {
            balance -= amt;
            System.out.println("取出金额" + amt + "你的余额为" + balance);
        } else {
            System.out.println("你的余额不足");
        }
    }
}
